
(async function () {
  var sites = require('./utils/sites')
  console.info('test start')
  var Dm5 = require('./plugin/dm5')
  var dm5= new Dm5()
  // var categoryList = await dm5.getComicCategory()
  // categoryList.forEach(caategory => {
  //   sites.createDir(__dirname+'/漫画下载/'+caategory.name)
  //   dm5.getComicPageList(caategory.href).then(function(res){
  //    console.info(res)
  //   })
  // });


  // let a = await dm5.getComicCategory()
  // for(let i= 0;i<a.length;i++){
  //   comicSrc='漫画下载/'+a[i].name
  //   await sites.createDir(comicSrc)
  //   let b = await dm5.getComicPageList(a[i].categoryUrl)
  //   for(let j=0;j<b.length;j++){
  //     let c = await dm5.getComicList(b[j].pageUrl)
  //     for(let k = 0;k<c.length;k++){
  //       let d = await dm5.getComicSynopsis(c[k].url)
  //       sites.writeData(d,comicSrc+'/'+c[k].name+'.json')
  //       console.info(comicSrc+'/'+c[k].name+'.json 写入成功')
  //     }    
  //   }      
  // }

  // let b = await dm5.getComicPageList('/manhua-list-cg39-size19/')
  // console.info(b)

  // let c = await dm5.getComicList('/manhua-list-cg39-size19-p0/')
  // console.info(c)

  //  let d = await dm5.getComicSynopsis('/manhua-xunshifumolu/')
  //  console.info(d)
  
  await dm5.downloadComicBychapter('/m571552/')

  console.info('test end')  
}())